package common.impl;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;

public class SmsSender {

	/**
	 * 发送方法
	 */
	public static int sendSMSmethod(String Mobile, String Content,
			String send_time) throws MalformedURLException,
			UnsupportedEncodingException {
		URL url = null;
		String CorpID = "LKSDK0000432";// 账户名
		String Pwd = "897612";// 密码
		String send_content = URLEncoder.encode(Content
				.replaceAll("<br/>", " "), "GBK");// 发送内容
		url = new URL("  http://mb345.com/WS/Send.aspx?CorpID=" + CorpID
				+ "&Pwd=" + Pwd + "&Mobile=" + Mobile + "&Content="
				+ send_content + "&Cell=&SendTime=" + send_time);
		BufferedReader in = null;
		int inputLine = 0;
		try {
			in = new BufferedReader(new InputStreamReader(url.openStream()));
			inputLine = new Integer(in.readLine()).intValue();
		} catch (Exception e) {
			inputLine = -2;
		}
		return inputLine;
	}

}
